<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
    xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:a4j="http://richfaces.org/a4j"
    xmlns:rich="http://richfaces.org/rich"
    xmlns:fn="http://java.sun.com/jsp/jstl/functions">

<body>
    <ui:composition template="../templates/template.xhtml">
    <ui:define name="titre">Saisie absence</ui:define>
    <ui:define name="zone1">
    	<div class="form">
    		<h:panelGroup layout="block">
    			<h:form id="form">
    				<h:messages id="messages" warnClass="msgWarn" errorClass="msgError" infoClass="msgInfo"
						globalOnly="true" />
					<h:panelGrid columns="2" columnClasses="tabline1, tabline2" styleClass="spanelTable">
						<h:panelGroup>
		         			<h:outputLabel value="Matricule" for="matriculeTxt" id="matriculeLbl" styleClass="label" />
					 	</h:panelGroup>
					 	<h:panelGroup>
					 		<h:inputText id="matriculeTxt" value="#{GestionDesSaisiesControleur.modele.absence.matricule}" required="true"/>
					 		<h:message id="msgmatriculeTxt" for="matriculeTxt" errorClass="msgError"/>
					 	</h:panelGroup>
					</h:panelGrid>
					<h:panelGrid columns="2" columnClasses="tabline1, tabline2" styleClass="spanelTable">
						<h:panelGroup>
				 			<h:outputLabel value="Date début " for="datedebutTxt" id="datedebutLabel" styleClass="label" />
				 		</h:panelGroup>
				 		<h:panelGroup>
							<rich:calendar id="datedebutTxt" title="Date début absene" 
											value="#{GestionDesSaisiesControleur.modele.absence.datedebutabsence}"
											locale="FR" datePattern="dd/MM/yyyy" enableManualInput="true"
											showApplyButton="false"  inputSize="10" 
											required="true"/>
							<h:message id="msgdatedebutTxt" for="datedebutTxt" errorClass="msgError"/>
						</h:panelGroup>
						<h:panelGroup>
							<h:outputLabel value="Date fin " for="datefinabsenceTxt" id="datefinabsenceLabel" styleClass="label" />
						</h:panelGroup>
						<h:panelGroup>
							<rich:calendar id="datefinabsenceTxt" title="Date fin absene" 
											value="#{GestionDesSaisiesControleur.modele.absence.datefinabsence}"
											locale="FR" datePattern="dd/MM/yyyy" enableManualInput="true"
											showApplyButton="false"  inputSize="10" 
											required="true" />
							<h:message id="msgdatefinabsenceTxt" for="datefinabsenceTxt" errorClass="msgError"/>
						</h:panelGroup>
						
						<h:panelGroup>
							<h:outputLabel value="Déclarée par" for="declarepar" id="declareparLabel" styleClass="label" />
						</h:panelGroup>
						<h:panelGroup>
							<h:selectOneMenu id="declarepar"  value="#{GestionDesSaisiesControleur.modele.absence.lienparente}" required="true" 
								 valueChangeListener="#{GestionDesSaisiesControleur.afficherAutre}">
									<f:selectItem  itemLabel="" itemValue="" />
						        	<f:selectItem  itemLabel="MERE" itemValue="MERE" />
						        	<f:selectItem  itemLabel="PERE" itemValue="PERE" />
						        	<f:selectItem  itemLabel="AUTRE" itemValue="AUTRE" />
						        	<a4j:ajax event="valueChange" render="lien" execute="@form"/>
						    </h:selectOneMenu>
						    <h:message id="msgdeclarepar" for="declarepar" errorClass="msgError"/>
						</h:panelGroup>
					</h:panelGrid>
					<a4j:outputPanel id="lien" >
					<h:panelGrid rendered="#{GestionDesSaisiesControleur.modele.afficherAutre}" columns="2" columnClasses="tabline1, tabline2" styleClass="spanelTable">
							<h:panelGroup id="lien1">
				        		<h:outputLabel id="autreLabel" for="autreTxt"  value="Nom prénom" styleClass="label"/>
				        	</h:panelGroup>
				        	<h:panelGroup id="lien2">
				        		<h:inputText id="autreTxt" value ="#{GestionDesSaisiesControleur.modele.absence.declarepar}" required="true" />
				        		<h:message id="msgautreTxt" for="autreTxt" errorClass="msgError"/>
				       		</h:panelGroup>
				       		<h:panelGroup id="lien3" >
				        		<h:outputLabel id="lienautreLabel" for="lienautreTxt"  value="Lien de parenté" styleClass="label"/>
				        	</h:panelGroup>
				        	<h:panelGroup id="lien4" >
				        		<h:inputText id="lienautreTxt" value ="#{GestionDesSaisiesControleur.modele.absence.lienparente}" />
				        		<h:message id="msglienautreTxt" for="lienautreTxt" errorClass="msgError"/>
				        	</h:panelGroup>
					</h:panelGrid>
					</a4j:outputPanel>
					<h:panelGrid columns="2" columnClasses="tabline1, tabline2" styleClass="spanelTable">	
			        	<h:panelGroup  >
			        		<h:outputLabel id="telLabel" for="telTxt"  value="Téléphone" styleClass="label"/>
			        	</h:panelGroup>
			        	<h:panelGroup  >
			        		<h:inputText id="telTxt" value ="#{GestionDesSaisiesControleur.modele.absence.tel}" 
			        		required="true" />
			        		<h:message id="msgtelTxt" for="telTxt" errorClass="msgError"/>
			       		</h:panelGroup>
			       		<h:panelGroup  >
			        		<h:outputLabel id="motifLabel" for="motifTxt"  value="Motif absence" styleClass="label"/>
			        	</h:panelGroup>
			       		<h:panelGroup  >
			        		<h:inputTextarea id="motifTxt" value ="#{GestionDesSaisiesControleur.modele.absence.motifabsence}" 
			        		required="true"  style="width:300px; height:100px"/>
			        		<h:message id="msgmotifTxt" for="motifTxt" errorClass="msgError"/>
			        	</h:panelGroup>
					</h:panelGrid>
					<div id="boutons">
		  				
							<h:commandLink styleClass="btValider" value="Enregistrer" action="#{GestionDesSaisiesControleur.enregisterAbsence}">
							</h:commandLink>
						
					</div>
    			</h:form>
    		</h:panelGroup>
    	</div>
    </ui:define>
</ui:composition>
</body>
</html>